<template>
    <div class="register">
        <form>
            <div>
                <label for="mobile">手机号：</label>
                <input type="text" id="mobile" v-model="registerForm.mobile" />
            </div>

            <div>
                <label for="password">密码：</label>
                <input
                    type="password"
                    id="password"
                    v-model="registerForm.password"
                />
            </div>

            <div>
                <button @click.prevent="register">注册</button>
            </div>
        </form>
    </div>
</template>

<script>
export default {
    data() {
        return {
            registerForm: {
                mobile: '',
                password: '',
            },
        };
    },
    methods: {
        async register() {
            const res = await this.$http.post('/zhuce', this.registerForm);
            // 跳转到登录页面
            this.$router.push('/login');
        },
    },
};
</script>

<style lang="scss" scoped></style>
